Click here for interactive plots:

https://kforthman.shinyapps.io/COVID19_Interactive_Plots/

Click here to see how cities and counties overlap:

https://kforthman.shinyapps.io/500citiescounties

Compare COVID stats to Neighborhood Factors

data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

Compare COVID stats to 500 cities data and Neighborhood Factors

data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)

—-Linear Mixed Effects Model —-

this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider
## rescaling

## Warning: Some predictor variables are on very different scales: consider
## rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
##    Data: county.Demo_and_Covid.500counties
## 
## REML criterion at convergence: -1196.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.9239 -0.3467 -0.0905  0.1813  5.7059 
## 
## Random effects:
##  Groups   Name        Variance    Std.Dev.
##  stateID  (Intercept) 0.000001237 0.001112
##  Residual             0.000013726 0.003705
## Number of obs: 178, groups:  stateID, 33
## 
## Fixed effects:
##                                  Estimate     Std. Error             df
## (Intercept)                 -0.0088728834   0.0095789526  66.4431597640
## Affluence                    0.0047551818   0.0011057928  98.8186326132
## Singletons.in.Tract          0.0014636650   0.0009125870 139.7179627723
## Seniors.in.Tract             0.0009063921   0.0011971126 148.3323289807
## African.Americans.in.Tract   0.0005683633   0.0010066109 150.8215890761
## Noncitizens.in.Tract         0.0008957367   0.0007772629 126.0172194073
## High.BP                      0.0001790185   0.0001891643 107.1534585888
## Binge.Drinking               0.0001313838   0.0001565644  40.0016387225
## Cancer                      -0.0009458260   0.0011016952  96.5465275784
## Asthma                       0.0006009592   0.0005552458  38.9547625118
## Heart.Disease                0.0010436256   0.0013046790  71.1343947056
## COPD                        -0.0000906337   0.0010788490  73.4636711157
## Smoking                     -0.0000873279   0.0002272215  77.9845008855
## Diabetes                    -0.0005154809   0.0005350691  78.8502298269
## No.Physical.Activity        -0.0000262524   0.0002049846  87.1530062200
## Obesity                      0.0002431056   0.0001768796  94.5915812540
## Poor.Sleeping.Habits        -0.0000184302   0.0001655746 121.6091808903
## Poor.Mental.Health          -0.0000630741   0.0004139261  30.2850452692
## Testing_Rate                 0.0000004972   0.0000002901  33.0683157421
## Hospitalization_Rate        -0.0000918852   0.0000873027  27.1597043361
##                            t value  Pr(>|t|)    
## (Intercept)                 -0.926    0.3576    
## Affluence                    4.300 0.0000401 ***
## Singletons.in.Tract          1.604    0.1110    
## Seniors.in.Tract             0.757    0.4502    
## African.Americans.in.Tract   0.565    0.5732    
## Noncitizens.in.Tract         1.152    0.2513    
## High.BP                      0.946    0.3461    
## Binge.Drinking               0.839    0.4064    
## Cancer                      -0.859    0.3927    
## Asthma                       1.082    0.2858    
## Heart.Disease                0.800    0.4264    
## COPD                        -0.084    0.9333    
## Smoking                     -0.384    0.7018    
## Diabetes                    -0.963    0.3383    
## No.Physical.Activity        -0.128    0.8984    
## Obesity                      1.374    0.1726    
## Poor.Sleeping.Habits        -0.111    0.9116    
## Poor.Mental.Health          -0.152    0.8799    
## Testing_Rate                 1.714    0.0959 .  
## Hospitalization_Rate        -1.052    0.3018    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of fixed effects could have been required in summary()
## 
## Correlation of Fixed Effects:
##             (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence    0.134                                                        
## Sngltns.n.T  0.018  0.078                                                 
## Snrs.n.Trct  0.569  0.377  0.193                                          
## Afrcn.Am..T  0.159  0.147 -0.410  0.139                                   
## Nnctzns.n.T -0.004  0.105  0.045  0.067 -0.079                            
## High.BP     -0.004  0.241  0.067  0.112 -0.096  0.398                     
## Bing.Drnkng -0.286 -0.199 -0.300 -0.196  0.076  0.040  0.133              
## Cancer      -0.590 -0.196  0.181 -0.328 -0.075 -0.141 -0.380 -0.111       
## Asthma      -0.369 -0.205 -0.233 -0.183  0.088  0.099  0.171  0.002  0.045
## Heart.Dises -0.148  0.075 -0.289 -0.151  0.249 -0.105 -0.015  0.060 -0.472
## COPD         0.565  0.041  0.136  0.281 -0.006  0.286  0.183  0.109 -0.270
## Smoking     -0.167  0.139 -0.169 -0.102 -0.058 -0.005 -0.069 -0.297  0.086
## Diabetes     0.075 -0.339 -0.107 -0.227 -0.307 -0.329 -0.525  0.045  0.239
## N.Physcl.Ac -0.181 -0.055  0.078 -0.038 -0.036 -0.218 -0.116  0.106  0.481
## Obesity      0.006  0.431  0.422  0.305  0.144  0.200 -0.084 -0.241  0.111
## Pr.Slpng.Hb -0.460 -0.402  0.144 -0.362 -0.361 -0.016 -0.189  0.094  0.144
## Pr.Mntl.Hlt -0.336  0.257 -0.061 -0.073  0.099 -0.181 -0.079  0.057  0.315
## Testing_Rat  0.180 -0.085 -0.033  0.016  0.048 -0.111 -0.017  0.001 -0.179
## Hsptlztn_Rt -0.133 -0.222 -0.125 -0.216 -0.040 -0.135 -0.132 -0.117  0.043
##             Asthma Hrt.Ds COPD   Smokng Diabts N.Ph.A Obesty Pr.S.H Pr.M.H
## Affluence                                                                 
## Sngltns.n.T                                                               
## Snrs.n.Trct                                                               
## Afrcn.Am..T                                                               
## Nnctzns.n.T                                                               
## High.BP                                                                   
## Bing.Drnkng                                                               
## Cancer                                                                    
## Asthma                                                                    
## Heart.Dises  0.277                                                        
## COPD        -0.374 -0.561                                                 
## Smoking      0.070  0.204 -0.514                                          
## Diabetes    -0.123 -0.287 -0.111  0.240                                   
## N.Physcl.Ac  0.012 -0.384 -0.007 -0.333 -0.062                            
## Obesity     -0.272 -0.096  0.164 -0.199 -0.395 -0.062                     
## Pr.Slpng.Hb  0.073  0.250 -0.206  0.002 -0.013 -0.111 -0.168              
## Pr.Mntl.Hlt -0.237  0.087 -0.447  0.087  0.027  0.053  0.096 -0.187       
## Testing_Rat -0.359 -0.029  0.174  0.165  0.123 -0.304  0.090 -0.122 -0.089
## Hsptlztn_Rt  0.043  0.090 -0.118  0.095  0.097 -0.040 -0.050 -0.001 -0.038
##             Tstn_R
## Affluence         
## Sngltns.n.T       
## Snrs.n.Trct       
## Afrcn.Am..T       
## Nnctzns.n.T       
## High.BP           
## Bing.Drnkng       
## Cancer            
## Asthma            
## Heart.Dises       
## COPD              
## Smoking           
## Diabetes          
## N.Physcl.Ac       
## Obesity           
## Pr.Slpng.Hb       
## Pr.Mntl.Hlt       
## Testing_Rat       
## Hsptlztn_Rt  0.259
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling

Testing Rate

testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]

col.state <- rep("pink", nrow(testing.data.state))

avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)

col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"

par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")

Pink highlights the last 14 days.

day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)

twoweek.col <- c(rep("grey", n.days-day.first.case-13), rep("pink", 14))

par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 cases by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)

barplot(US.total$cases.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 cases by Date in US, log scale", 
        las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
        col = twoweek.col, border = F)

barplot(US.total$deaths.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 deaths by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)

barplot(US.total$deaths.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Total COVID-19 deaths by Date in US, log scale", 
        las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
        col = twoweek.col, border = F)

barplot(US.total$rise.cases.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Rise in Cases of COVID-19 by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)

barplot(US.total$rise.deaths.total[day.first.case:n.days], 
        names = US.total$day[day.first.case:n.days],
        main = "Rise in Deaths of COVID-19 by Date in US", 
        las = 2, cex.axis = 1, cex.names = 0.5,
        col = twoweek.col, border = F)